PlayBufCF crossfading version of playbuf

part of wslib

PlayBufCF.ar(numChannels, bufnum, rate, trigger, startPos, loop, lag )

Arguments are the same as PlayBuf. But PlayBufCF makes a crossfade every time it is triggered. In order to do so it uses two PlayBufs internally uses equal power crossfades between them. Triggers can be audio or control rate.

lag: the crossfade duration in seconds (default: 0.1)

See also: PlayBuf

b = Buffer.read(s, "sounds/a11wlk01.wav"); // remember to free the buffer later.

(

z = SynthDef(\help_PlayBufCF, {

Out.ar( \out.ir(0),

PlayBufCF.ar(1, \bufnum.kr(0), BufRateScale.kr(\bufnum.kr),

Impulse.kr(2),

WhiteNoise.kr(1).range(0, BufFrames.kr(\bufnum.kr) - (0.5 * 44100) ) )

)

}).play(s, [\bufnum, b]);

)

z.free;

/// compare with PlayBuf:

(

y = SynthDef(\help_PlayBufCF2, {| out = 0, bufnum = 0 |

Out.ar( \out.ir(0),

PlayBuf.ar(1, \bufnum.kr(0), BufRateScale.kr(\bufnum.kr),

Impulse.kr(2),

WhiteNoise.kr(1).range(0, BufFrames.kr(\bufnum.kr) - (0.5 * 44100) ) )

)

}).play(s, [\bufnum, b]);

)

y.free;

b.free;